package main

import (
	"time"

	"gitee.com/wu-jin-feng/kinfu/fgin"
	"github.com/gin-gonic/gin"
)

func main() {
	f := fgin.Fgin{}
	r := f.GetHttpServer("./test.yaml")
	r.GET("/haha", func(ctx *gin.Context) {
		fgin.ReturnJson(ctx, 200, "haha", nil)
	})
	r.GET("/public", func(ctx *gin.Context) {
		fgin.ReturnJson(ctx, 200, "public", nil)
	})
	publicGroup := r.Group("public")
	publicGroup.GET("/ha", func(ctx *gin.Context) {
		fgin.ReturnJson(ctx, 200, "public ha", nil)
	})
	doneGroup := r.Group("done")
	doneGroup.GET("/public/ha", func(ctx *gin.Context) {
		time.Sleep(1 * time.Second)
		fgin.ReturnJson(ctx, 200, "done public ha", nil)
	})
	doneGroup.GET("/ha", func(ctx *gin.Context) {
		fgin.ReturnJson(ctx, 200, "done ha", nil)
	})
	f.Run(r)
}
